<template>
  <a-modal :title="title" :width="940" :visible="visible" :confirmLoading="loading" @ok="()=>{this.visible=false}" @cancel="()=>{this.visible=false}">
    <div class="table-page-search-wrapper">
      <a-form layout="inline">
        <a-row :gutter="48">
          <a-col :md="12" :sm="12">
            <a-form-item label="订单编号">
              {{ this.entity.WipOrderNo }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="订单类型">
              {{ this.entity.WipOrderType==="1"?"正常订单":"返工返修订单" }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="订单物料">
              {{ this.entity.ProductNo }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="订单物料描述">
              {{ this.entity.ProductName }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="订单物料简码">
              {{ this.entity.ProductAlias }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="数量">
              {{ this.entity.Quantity }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="工厂">
              {{ this.entity.Facility }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="产线">
              {{ this.entity.ProductionLine }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="工作中心">
              {{ this.entity.WorkCenter }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="组">
              {{ this.entity.WipOrderGroup }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="计划开始">
              {{ moment(this.entity.ScheduledStartDate).format('YYYY-MM-DD') }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="计划结束">
              {{ moment(this.entity.ScheduledCompleteDate).format('YYYY-MM-DD') }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="订单状态">
              {{ this.ProgressStatusName(this.entity.ProgressStatus) }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="执行状态">
              {{ this.StatusName(this.entity.Status) }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="序列号">
              {{ this.StatusName(this.entity.SerialNo) }}
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item label="下发时间">
              {{ this.IssusedTime(this.entity.IssuedTime) }}
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
  </a-modal>
</template>

<script>
import moment from 'moment'
import { mapActions } from 'vuex'
import MainSvc from '@/api/Exec/PlanSvc'
export default {
  components: {
    MainSvc
  },
  props: {},
  data() {
    return {
      title: '查看详情',
      layout: { labelCol: { xs: { span: 24 }, sm: { span: 6 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 14 } } },
      visible: false,
      loading: false,
      entity: {}
    }
  },
  computed: {
  },
  created() { },
  methods: {
    ...mapActions({ getConfig: 'getConfig' }),
    moment,
    init() {
      this.loading = false
      this.visible = true
    },
    ProgressStatusName(value) {
        if (value === '110') {
        return '已接收'
        } else if (value === '120') {
        return '进行中'
        } else if (value === '130') {
        return '已完工'
        } else if (value === '140') {
        return '已删除'
        } else if (value === '150') {
        return '强制关闭'
        } else {
        return value
        }
    },
    StatusName(value) {
        if (value === 0) {
            return '待下发'
        } else if (value === 1) {
            return '执行中'
        } else if (value === 2) {
            return '已完成'
        } else if (value === 3) {
            return '已取消'
        } else if (value === 4) {
            return '挂起'
        } else {
            return value
        }
    },
    IssusedTime(value) {
        if (value !== null) {
        return moment(value).format('YYYY-MM-DD HH:mm:ss')
      } else {
        return ''
      }
    },
    openForm(record, title) {
      this.title = title
      this.entity = record
      this.init()
    }
  }
}
</script>
